using System;

namespace Csharp01._1014
{
    public class Demo
    {
        public void TestPrint1()
        {
           
            int[] arr = { 64, 34, 25, 12, 22, 11, 90 };
            
           
            Console.WriteLine("原始数组:");
            for (int i = 0; i < arr.Length; i++)
            {
                Console.Write(arr[i] + " ");
            }
            Console.WriteLine();
            
            // 冒泡排序实现
            int n = arr.Length;
            for (int i = 0; i < n - 1; i++)
            {
                for (int j = 0; j < n - i - 1; j++)
                {
                    if (arr[j] > arr[j + 1])
                    {
                        // 交换元素
                        int temp = arr[j];
                        arr[j] = arr[j + 1];
                        arr[j + 1] = temp;
                    }
                }
            }
            
           
            Console.WriteLine("排序后的数组:");
            for (int i = 0; i < arr.Length; i++)
            {
                Console.Write(arr[i] + " ");
            }
            Console.WriteLine();
        }
    }
}